import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');

// 新增
const order = r => require.ensure([], () => r(require('@/page/orderManagement/order')), 'order');
const chargeback = r => require.ensure([], () => r(require('@/page/orderManagement/chargeback')), 'chargeback');
const freight = r => require.ensure([], () => r(require('@/page/customSettings/freight')), 'freight');
const goodsClassify = r => require.ensure([], () => r(require('@/page/customSettings/goodsClassify')), 'goodsClassify');
const goodsList = r => require.ensure([], () => r(require('@/page/commodityManagement/goodsList')), 'goodsList');
const addgoods = r => require.ensure([], () => r(require('@/page/commodityManagement/addgoods')), 'addgoods');
const addDetails = r => require.ensure([], () => r(require('@/page/commodityManagement/addDetails')), 'addDetails');
const classifyList = r => require.ensure([], () => r(require('@/page/commodityManagement/classifyList')), 'classifyList');
const notice = r => require.ensure([], () => r(require('@/page/Announcements/notice')), 'notice');

const routes = [
	{
		path: '/',
		component: login
	},
	{
		path: '/manage',
		component: manage,
		name: '',
		children: [{
			path: '',
			component: home,
			meta: [],
		},{
			path: '/order',
			component: order,
			meta: ['订单管理', '订单管理'],
		},{
			path: '/chargeback',
			component: chargeback,
			meta: ['订单管理', '退款单管理'],
		},{
			path: '/freight',
			component: freight,
			meta: ['自定义设置', '运费设置'],
		},{
			path: '/goodsClassify',
			component: goodsClassify,
			meta: ['自定义设置', '商品分类管理'],
		},{
			path: '/goodsList',
			component: goodsList,
			meta: ['商品管理', '商品列表'],
		},{
			path: '/addgoods',
			component: addgoods,
			meta: ['商品管理', '添加商品'],
		},{
			path: '/addDetails',
			component: addDetails,
			meta: ['商品管理', '添加图片'],
		},{
			path: '/classifyList',
			component: classifyList,
			meta: ['商品管理', '分类列表'],
		},{
			path: '/notice',
			component: notice,
			meta: ['公告管理', '公告列表'],
		}]
	}
]

export default new Router({
	routes,
	strict: process.env.NODE_ENV !== 'production',
})